<?php

namespace App\Model\Foundation;

use Illuminate\Database\Eloquent\Model;

class Teacher extends Model
{
    public $timestamps = false;

    public $primaryKey = 'teacheruid';

    protected $fillable = [
        'account',
        'ClassInNo',
        'firstname',
        'lastname',
        'dateofbirth',
        'sex',
        'email',
        'mobile',
        'status',
        'title',
        'remark1',
        'remark2',
        'photo',
        'introduce',
        'resume',
        'worktimetemplateType',
        'worktimetempateid',
    ];

    // function setCoursedescAttribute()
    // {
    //   if(is_array($this->coursedesc))
    //   $this->coursedesc = json_encode($this->coursedesc);
    //   else{
    //     $this->coursedesc = json_decode($this->coursedesc);
    //   }
    // }

    /**
     * 设置教师[1:*]学历一对多映射关系
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public  function educations()
    {
        return $this->hasMany('App\Model\Foundation\TeacherEducation', 'teacheruid');
    }

    /**
     * 设置 教师[1:*]经验,一堆多关系
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public  function experiences()
    {
        return $this->hasMany('App\Model\Foundation\TeacherExperience', 'teacheruid');
    }
}
